$OpenBSD: patch-src_corelib_plugin_qfactoryloader_cpp,v 1.1 2017/01/08 11:51:14 sthen Exp $

Stop unloading plugins in QPluginLoader and QFactoryLoader

https://bugreports.qt.io/browse/QTBUG-50829
http://lists.qt-project.org/pipermail/development/2015-November/023681.html
https://codereview.qt-project.org/#/c/140750/4//ALL,unified

--- src/corelib/plugin/qfactoryloader.cpp.orig	Sun Jan  8 10:57:50 2017
+++ src/corelib/plugin/qfactoryloader.cpp	Sun Jan  8 10:58:25 2017
@@ -208,10 +208,12 @@ void QFactoryLoader::update()
                     ++keyUsageCount;
                 }
             }
-            if (keyUsageCount || keys.isEmpty())
+            if (keyUsageCount || keys.isEmpty()) {
+		library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload
                 d->libraryList += library;
-            else
+            } else {
                 library->release();
+            }
         }
     }
 #else
